package cn.net.shuxing.yifu.common.service;

import cn.net.shuxing.yifu.common.bean.ShareholderWallet;
import cn.net.shuxing.yifu.common.bean.UserCapital;
import cn.net.shuxing.yifu.common.bean.UserInfo;
import cn.net.shuxing.yifu.common.constant.UserType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;

@Service
public class ShareholderWalletService {

    @Autowired
    private UserInfoService userInfoService;

    @Autowired
    private UserCapitalService userCapitalService;

    @Autowired
    private ShareholderShouldPayService shareholderShouldPayService;

    @Autowired
    private CashWalletService cashWalletService;

    public ShareholderWallet getByShareholderId(Integer shareholderId) {
        ShareholderWallet shareholderWallet = new ShareholderWallet();
        shareholderWallet.setUserInfo(userInfoService.getByPrimaryKey(shareholderId));
        shareholderWallet.setShareholderCashWallet(cashWalletService.getByPrimaryKey(shareholderId));
        shareholderWallet.setUserCapitalList(userCapitalService.getsByUserIdAndUserType(shareholderId, UserType.SHAREHOLDER));
        return shareholderWallet;
    }

//    public void addCash(Integer memberId, BigDecimal cashCount) {
//        cashWalletService.addCash(memberId, cashCount);
//    }
//
//    public void reduceCash(Integer memberId, BigDecimal cashCount) {
//        cashWalletService.reduceCash(memberId, cashCount);
//    }


    public void addAliveCoin(Integer memberId, Integer coinTypeId, BigDecimal aliveCoinCount, int type) {
        userCapitalService.addAliveCoin(memberId, coinTypeId, aliveCoinCount, type);
    }

    public void reduceAliveCoin(Integer memberId, Integer coinTypeId, BigDecimal aliveCoinCount, int type) {
        userCapitalService.reduceAliveCoin(memberId, coinTypeId, aliveCoinCount, type);
    }

    public void addSleepCoin(Integer memberId, Integer coinTypeId, BigDecimal sleepCoinCount) {
        userCapitalService.addSleepCoin(memberId, coinTypeId, sleepCoinCount);
    }

    public void reduceSleepCoin(Integer memberId, Integer coinTypeId, BigDecimal sleepCoinCount) {
        userCapitalService.reduceSleepCoin(memberId, coinTypeId, sleepCoinCount);
    }
}
